<script setup>
import { RouterLink, RouterView } from "vue-router";
</script>

<template>
  <header>
    <img
      alt="Vue logo"
      class="logo"
      src="@/assets/logo.svg"
      width="125"
      height="125"
    />

    <div class="input-container">
      <input class="input" name="text" type="text" />
      <label class="label" for="input">片名 / 导演 / 演员 / 分类 / 标签</label>
      <div class="topline"></div>
      <div class="underline"></div>
    </div>

    <div class="wrapper">
      <nav>
        <RouterLink to="/">Home</RouterLink>
        <RouterLink to="/about">About</RouterLink>
      </nav>
    </div>
  </header>
  <RouterView />
</template>

<style scoped lang="scss">
header {
  display: flex;
  flex-direction: column;
  place-items: center;
  img,
  .input-box,
  .svg-frame,
  .input-container {
    margin-bottom: 20px;
  }

  .input-container {
    position: relative;
  }

  .input {
    padding: 10px;
    width: 360px;
    height: 40px;
    border: 2px solid #0b2447;
    border-top: none;
    font-size: 16px;
    background: transparent;
    outline: none;
    box-shadow: 7px 7px 0px 0px #0b2447;
    transition: all 0.5s;
  }

  .input:focus {
    box-shadow: none;
    transition: all 0.5s;
  }

  .label {
    position: absolute;
    top: 10px;
    left: 10px;
    color: #0b2447;
    transition: all 0.5s;
    transform: scale(0);
    z-index: -1;
  }

  .input-container .topline {
    position: absolute;
    content: "";
    background-color: #0b2447;
    width: 0%;
    height: 2px;
    right: 0;
    top: 0;
    transition: all 0.5s;
  }

  .input-container input[type="text"]:focus ~ .topline {
    width: 35%;
    transition: all 0.5s;
  }

  .input-container .underline {
    position: absolute;
    content: "";
    background-color: #0b2447;
    width: 0%;
    height: 2px;
    right: 0;
    bottom: 0;
    transition: all 0.5s;
  }

  .input-container input[type="text"]:focus ~ .underline {
    width: 100%;
    transition: all 0.5s;
  }

  .input-container input[type="text"]:focus ~ .label {
    top: -10px;
    transform: scale(1);
    transition: all 0.5s;
  }
  @keyframes catLogo {
    0% {
      transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }
    50% {
      transform: rotateX(-60deg) rotateY(720deg) rotateZ(0deg);
      transform: scale3d(1.4, 1.8, 0.6);
    }
    100% {
      transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg);
    }
  }
  > img:hover {
    cursor: grab;
    animation: catLogo 3s linear 0s normal none;
  }
}
</style>
